<form id="memberseditfm" method="post" style="padding: 8px;">
    <input type="hidden" name="id" value="<?php echo $dataset['id'];?>"/>
    <table border="0" width="100%" cellspacing="1" cellpadding="5" class="formtable">
        <tr bgcolor="#FFFFFF">
            <td class="tlabel"  width="10%">账号：</td>
            <td width="40%"><input name="phone" type="text"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入电话.." required="true" v-model="params.phone"></td>
            <td class="tlabel"  width="10%">密码：</td>
            <td width="40%"><input name="password" type="text" class="forminput inputstyle validatebox-text textbox-prompt"
                                   placeholder="无需修改请留空.."  v-model="params.resetPwd"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >姓名：</td>
            <td colspan="3"><input name="name" type="text"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入姓名.."  v-model="params.name">
                <label style="padding-left: 20px;"><input name="gender" type="radio"
                                                          class="textbox-prompt"  v-model="params.gender"
                    value="1" >先生</label>
                <label style="padding-left: 20px;"><input name="gender" type="radio"
                                                          class="textbox-prompt"  v-model="params.gender"
                    value="0" >女士</label>
            </td>
        </tr>

        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >会员积分：</td>
            <td><input name="score" type="text" readonly
                       class="forminput inputstyle validatebox-text easyui-validatebox"
                       v-model="params.score"></td>
            <td class="tlabel" >会员等级：</td>
            <td><input type="text" readonly
                       class="forminput inputstyle validatebox-text easyui-validatebox"
                       v-model="params.rankName"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >账户余额：</td>
            <td colspan="3"><input name="money" type="text" readonly
                       class="forminput inputstyle validatebox-text easyui-validatebox"
                       v-model="params.money"></td>
        </tr>

        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >生日：</td>
            <td><input name="birthday" type="text"
                       class="forminput inputstyle validatebox-text easyui-validatebox easyui-datebox"
                       placeholder="请输入电话.." v-model="params.birthday"></td>
            <td class="tlabel" >邮箱：</td>
            <td><input name="email" type="text" style="width: 200px;"
                       class="forminput inputstyle validatebox-text easyui-validatebox"
                       placeholder="请输入邮箱.." v-model="params.email"></td>
        </tr>

		<tr bgcolor="#FFFFFF">
            <td class="tlabel" >地址：</td>
            <td colspan="3"><input name="address" type="text" style="width: 545px;"
                                   class="forminput inputstyle validatebox-text easyui-validatebox"
                                   placeholder="请输入地址.." v-model="params.address"></td>
        </tr>

        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >状态：</td>
            <td>
                <label><input name="status" type="checkbox" class="textbox-prompt" v-model="params.status">激活</label></td>
            </td>
            <td class="tlabel" >排序：</td>
            <td><input name="sortorder" type="text"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入排序.." v-model="params.sortorder"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >备注：</td>
            <td colspan="3" style="padding-top: 10px;"><textarea name="remark" style="width: 545px;height: 70px;" v-model="params.remark"
                                      class="formarea validatebox-text textbox-prompt easyui-validatebox"
                                      placeholder="请输入备注.."></textarea></td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >图片：</td>
            <td colspan="3">
                <div title="上传图片">
                    <div class="col-md-12">
                        <div id="container" style="background-color:#F9F9F4">
                            <a class="btn btn-default btn-lg" id="pickfiles" href="#" style="text-decoration: none;">
                                <div style="padding:20px;"><i class="iconfont icon-xiangji"></i> 点击上传图片，或者将图片拖至此处。</div>
                            </a>
                        </div>
                    </div>
                    <div style="display:none" id="success" class="col-md-12">
                        <div class="alert-success">
                            队列全部文件处理完毕
                        </div>
                    </div>
                    <div class="col-md-12 ">
                        <table id="uploadtable" class="formtable" id="fsUploadProgressTable1">
                            <thead>
                            <tr>
                                <th class="tlabel">图片</th>
                                <th class="tlabel">字节</th>
                                <th class="tlabel">网络文件</th>
                            </tr>
                            </thead>
                            <tbody id="fsUploadProgress">
                            <template v-if="params.avatar.length>0">
                                <tr id="o_1bdj11" class="progressContainer" style="opacity: 1;">
                                    <td class="progressName">
                                        <div class="Wrapper">
                                            <div class="imgWrapper col-md-3"><a class="linkWrapper" target="_blank"
                                                                                :href="params.avatar" title="查看原图"><img
                                                    width="100%" :src="params.avatar+'?imageView2/1/w/100/h/100'"></a></div>
                                        </div>
                                    </td>
                                    <td class="progressFileSize"></td>
                                    <td>
                                        <div class="info"><div style="word-break: break-all; line-height: 18px;">{{params.avatar}}</div>
                                                    <input name="images[]" :value="params.avatar" type="hidden">
                                                    <input class='l-btn l-btn-small' style="font-size:12px; padding:5px;"
                                                           onClick="$.messager.confirm('确认对话框', '您确认删除么？', function(r){	if (r){ $('#o_1bdj11').remove();}});"
                                                           value="删除图片" type="button">
                                        </div>
                                    </td>
                                </tr>
                            </template>
                            </tbody>
                        </table>
                    </div>
                </div>
            </td>
        </tr>
    </table>
</form>

<script>
    var membersEditVm = new Vue({
        el: '#memberseditfm',
        data: {
            params: JSON.parse('<?php echo addslashes($dataset);?>'),
        },
        methods: {
            submit: function () {
                membersEditVm.params.avatar = $("#memberseditfm input[name='images[]']")[0].value;
                $.post('/admin/members/membersupdate', membersEditVm.params, function (data) {
                    if (data.ret == 0) {
                        $.messager.show({
                            title: '提示',
                            msg: data.msg,
                            timeout: 3000,
                            showType: 'slide'
                        });
                        $('#memberseditfm').form('clear');
                        $("#membersdlg").dialog('close');
                        $("#members").datagrid('reload');
                    } else {
                        $.messager.alert('提示', data.msg, 'warning');
                    }
                }, 'json');
            }
        }
    });
    $(function () {
        $('#memberseditsubmit').click(function (data) {
            membersEditVm.submit();
        });
        qiniu_uploader('fsUploadProgress');
    });
    var addCommission = function(){
        $("#membersaddcommissiondlg").dialog({
            title: '添加奖励金',
            closed: false,
            width: 500,
            height: 204,
            cache: false,
            href: '/admin/members/addcommission?id=' + membersEditVm.params.id,
            modal: true,
            buttons: [{
                text: '保存',
                id: 'membersaddcommissionsubmit',
                iconCls: 'icon-ok',
            }, {
                text: '关闭',
                iconCls: 'icon-no',
                handler: function () {
                    $("#membersaddcommissiondlg").dialog('close');
                }
            }]
        });
    };
</script>
